# Maintainer: tobias <tobias@justdreams.de>
# Modified by: eliott <eliott@cactuswax.net>
# Original by Benjamin Andresen, klapmuetz [at] gmail [dot] com

pkgname=fcgi
pkgver=2.4.0
pkgrel=14
depends=('gcc-libs')
pkgdesc="FASTCgi (fcgi) is a language independent, high performant extension to CGI"
arch=('x86_64')
license=('custom')
options=('!makeflags')
url="http://www.fastcgi.com"
source=("https://sources.archlinux.org/other/packages/fcgi/${pkgname}-${pkgver}.tar.gz"
        'fcgi-2.4.0-configure.in.patch'
        'fcgi-2.4.0-Makefile.am-CPPFLAGS.patch'
        'fcgi-2.4.0-gcc44_fixes.patch'
        'fcgi-2.4.0-poll.patch')
sha256sums=('66fc45c6b36a21bf2fbbb68e90f780cc21a9da1fffbae75e76d2b4402d3f05b9'
            '1b22bf50d37a0086870f3259c04df05f92bfa74795212283a24baba62d617dc8'
            'df132dec038246ce9526f311c5d00ec103427111722c476f78069d7f1386529f'
            'c31eb921a662b53401a88caafbadb16b02ae809d25d0b6d8b1ac96d20803e9d5'
            '7fc1e0af1c71d7b86d1a90595fbadedbb01db0731b9e91b17fb5437680bb4e96')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  # Patches by Fedora:
  # http://pkgs.fedoraproject.org/cgit/fcgi.git/tree/
  patch -p1 -i "${srcdir}/fcgi-2.4.0-configure.in.patch"
  patch -p1 -i "${srcdir}/fcgi-2.4.0-Makefile.am-CPPFLAGS.patch"
  patch -p1 -i "${srcdir}/fcgi-2.4.0-gcc44_fixes.patch"
  patch -p1 -i "${srcdir}/fcgi-2.4.0-poll.patch"

  libtoolize --automake --copy --force
  aclocal
  autoheader
  automake --add-missing --force-missing --copy
  autoconf
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  ./configure --prefix=/usr
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}" install
  install -Dm644 LICENSE.TERMS "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
